﻿@using BankCreditPortfolio.DAL.Entities
@model BankCreditPortfolio.Areas.Admin.Models.AddTariffModel
@{
    ViewBag.Title = "AddTariff";
}
<h2>
    Create a New Tariff</h2>
<p>
    Use the form below to create a new tariff.
</p>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/Admin/Styles/forms.css")" rel="stylesheet" type="text/css" />
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true, "Tariff creation was unsuccessful. Please correct the errors and try again.")
    <div>
        <fieldset>
            <legend>Add Tariff Information</legend>
            <div class="editor-label">
                @Html.LabelFor(m => m.Title)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Title)
                @Html.ValidationMessageFor(m => m.Title)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.Description)
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(m => m.Description)
                @Html.ValidationMessageFor(m => m.Description)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.Min)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Min)
                @Html.ValidationMessageFor(m => m.Min)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.Max)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Max)
                @Html.ValidationMessageFor(m => m.Max)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.CreditPercent)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.CreditPercent)
                @Html.ValidationMessageFor(m => m.CreditPercent)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.Fine)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Fine)
                @Html.ValidationMessageFor(m => m.Fine)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.EarlyRepaymentFine)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.EarlyRepaymentFine)
                @Html.ValidationMessageFor(m => m.EarlyRepaymentFine)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.FirstPayment)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.FirstPayment)
                @Html.ValidationMessageFor(m => m.FirstPayment)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.OtherPayments)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.OtherPayments)
                @Html.ValidationMessageFor(m => m.OtherPayments)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.RequireGuarantor)
            </div>
            <div class="editor-field">
                @Html.CheckBoxFor(m => m.RequireGuarantor)
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.Time)
            </div>
            <div class="editor-field">
                @*<input class="datefield" data-val="true" data-val-required="Term is required."  id="Time" name="Time" type="text" value=@DateTime.Now />*@
            <div class="editor-label">
                @Html.LabelFor(x => x.Years)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(x => x.Years)
                @Html.ValidationMessageFor(x => x.Years)</div>
            <div class="editor-label">
                @Html.LabelFor(x => x.Months)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(x => x.Months)
                @Html.ValidationMessageFor(x => x.Months)
            </div>
            </div>
            <div class="editor-label">
                @Html.LabelFor(m => m.Currencies)
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(x => x.CurrencyId, new SelectList(Model.Currencies, "CurrencyId", "Title"))
            </div>
            <h3>
                Needed Documents</h3>
            @foreach (DocumentType i in ViewBag.Types)
            {
                var tmp = "checkbox:" + i.DocumentTypesId;
                <div class="editor-field">
                    @Html.CheckBox(tmp, true) @i.Title
                </div>
            }
            <p>
                Fields marked <b>bold</b> are required</p>
            <p>
                <input type="submit" name="button" value="Save" />
                <input type="button" onclick="ClickCancel();" value="Cancel" />
                <script type="text/javascript">
                    function ClickCancel() {
                        window.location = '@Url.Action("Tariffs", "Admin")';
                    }
                </script>
            </p>
        </fieldset>
    </div>
}
